package com.zd.util;

import com.zd.entity.News;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor

public class PageUtil {
    private Integer pageNo; //当前页号
    private Integer pageSize = 5; //页面大小
    private Integer totalCount; //总记录数
    private Integer totalPageCount; //总页数

    private List<News> newsList; //每页的数据

    public void setTotalCount(Integer totalCount) {
        this.totalCount = totalCount;
        //计算总页数
        this.totalPageCount = (totalCount % pageSize == 0 ? totalCount / pageSize : totalCount / pageSize + 1);
    }
}
